# -*- coding:utf-8 -*-

from fastapi import FastAPI


def create_app():
    """build app instance"""

    app = FastAPI(
        title="APScheduler Web API",
        openapi_url="/api/v1/openapi.json",
        docs_url="/api/v1/docs",
        redoc_url="/api/v1/redoc",
        description="""
          Base on FastAPI

          author: 100gle
          date: 2021-01-10
          """,
    )

    from .api import router

    app.include_router(router, tags=["APScheduler CRUD"])

    from .tasks import init_scheduler

    app.add_event_handler("startup", init_scheduler)

    return app
